STEP 8: We want to play against the computer, so it needs to make a choice too. We'll generate a random number and then use conditionals to choose rock, paper, or scissors based on that random number!

  • Click LOGIC, then and drag Random Integer to the bottom of your program.
  • Change the second integer in .randint() from 10 to 3. This sets the range of numbers to choose from.

Our game has three options, so we'll have the computer choose a number between 1 and 3.

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)